/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.business.account.facade.info;

import info.peigen.hotpot.business.account.facade.enums.AccountStatus;
import info.peigen.hotpot.business.account.facade.enums.AccountType;
import info.peigen.hotpot.business.router.facade.Channel;
import info.peigen.hotpot.common.core.enums.Currency;
import info.peigen.hotpot.common.core.lang.money.Money;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import java.util.Date;

import static info.peigen.hotpot.business.account.facade.enums.AccountStatus.Normal;
import static info.peigen.hotpot.common.core.enums.Currency.CNY;


/**
 * <b>(AccountInfo)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/9/15
 */
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class AccountInfo {
    /** 账户类型 */
    @NotNull
    AccountType   type;
    /** customerId */
    @NotEmpty
    String        customerId;
    /** 账户号,如果是客户账户则和customerId一致;备付金账户没有customerId,且号码特殊 */
    @NotEmpty
    String        accountId;
    /** 账户币种 */
    @Builder.Default
    Currency      currency      = CNY;
    /** 余额 */
    @Builder.Default
    Money         balance       = Money.zero();
    /** 在途资金 */
    @Builder.Default
    Money         transitAmount = Money.zero();
    /** 账户状态 */
    @Builder.Default
    AccountStatus status        = Normal;

    // ----------- 备付金账户 -----------
    /** 账户别名 */
    String  aliasName;
    /** 备付金渠道 */
    Channel channel;

    // ----------- 客户账户 -----------
    /** 冻结资金 */
    @Builder.Default
    Money freezeAmount        = Money.zero();
    /** 信用额度 */
    @Builder.Default
    Money creditQuotaAmount   = Money.zero();
    /** 历史收入总金额 */
    @Builder.Default
    Money historyIncomeAmount = Money.zero();
    /** 历史支出总金额 */
    @Builder.Default
    Money historyPaidAmount   = Money.zero();

    /** 创建时间 */
    Date   createTime;
    /** memo */
    String memo;

}